From ba619ded64aa5b08b9195c2d2826f7ff94de39f6 Mon Sep 17 00:00:00 2001 From: parkrrrr Date: Mon, 21 Jul 2003 21:19:02 +0000 Subject: [PATCH] add 'exclude' option to radius filter --- README | 6 ++++-- position.c | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README b/README index 3b5963aab..ee13a2032 100644 --- a/README +++ b/README @@ -402,7 +402,7 @@ DATA FILTERS line by passing the distance=XXX option to the filter. Distance options may be expressed in feet (distance=3f) or meters (distance=1m). The default is zero feet, essentially a duplicate - position. + position. For example: @@ -420,7 +420,9 @@ DATA FILTERS are declared on the command line by passing the distance=X.XX, lat=X.XX, and lon=X.XX options to the filter. Distance options may be expressed in miles (distance=3M) or kilometers (distance=3K). - The default is zero miles. + The default is zero miles. Additionally, the exclude option may + be specified to reverse the effect of the filter, so that points + further from the center are kept and closer points are discarded. For example: diff --git a/position.c b/position.c index e83abc0b9..3b4967099 100644 --- a/position.c +++ b/position.c @@ -32,6 +32,7 @@ static double pos_dist; static char *distopt; static char *latopt; static char *lonopt; +static char *exclopt; waypoint * home_pos; @@ -50,6 +51,7 @@ arglist_t radius_args[] = { {"lat", &latopt, "Latitude for center point (D.DDDDD)"}, {"lon", &lonopt, "Longitude for center point (D.DDDDD)"}, {"distance", &distopt, "Maximum distance from center"}, + {"exclude", &exclopt, "Exclude points close to center"}, {0, 0, 0} }; @@ -195,7 +197,7 @@ radius_process(void) /* convert radians to float point statute miles */ dist = (((dist * 180.0 * 60.0) / M_PI) * 1.1516); - if (dist >= pos_dist) { + if ((dist >= pos_dist) == (exclopt == NULL)) { waypt_del(waypointp); waypt_free(waypointp); continue; -- 2.30.2